// JavaScript Document


function addUpdate(jia){
	var c = jia.parent().find(".n_ipt").val();
	c=parseInt(c)+1;
	jia.parent().find(".n_ipt").val(c);
}

function jianUpdate(jian){    
	var c = jian.parent().find(".n_ipt").val();
	if(c==1){    
		c=1;    
	}else{    
		c=parseInt(c)-1;    
		jian.parent().find(".n_ipt").val(c);
	}
}    




// function addUpdate1(jia){
// 	var c = jia.parent().find(".car_ipt").val();
// 	c=parseInt(c)+1;
// 	jia.parent().find(".car_ipt").val(c);
//
// }
function addUpdate1(quantity,cost,id){
	// 添加数量
	jQuery.ajax({
		type: "POST",
		url: "/addGoodsQuantity",
		data: {"id":id,"cost":cost,"quantity":quantity},
		success: function(msg){
			if (msg) {
				location.reload()
			} else {
				alert("添加失败，请稍后在试。。");
			}
		}
	});

}


function jianUpdate1(quantity,cost,id){
	jQuery.ajax({
		type: "POST",
		url: "/deductionGoodsQuantity",
		data: {"id":id,"cost":cost,"quantity":quantity},
		success: function(msg){
			if (msg) {
				location.reload()
			} else {
				alert("减除失败，请稍后在试。。");
			}
		}
	});
}    
